package org.jeecg.modules.online.cgform.converter;

import org.springframework.stereotype.Component;
import java.util.Map;

@Component("customDemoConverter")
public class CustomDemoConverter implements FieldCommentConverter {

    @Override
    public String converterToVal(String txt) {
        if(txt!=null && txt.equals("管理员1")){
            return "admin";
        }else{
            return txt;
        }
    }

    @Override
    public String converterToTxt(String val) {
        if(val!=null){
            if(val.equals("admin"))
            return "管理员1";

            if(val.equals("scott"))
            return "管理员2";
        }
        return val;
    }

    @Override
    public Map<String, String> getConfig() {
        return null;
    }
}
